home *** CD-ROM | disk | FTP | other *** search
/ Mission 3 / Mission 3.zip / Mission 3.iso / texte / qed / src / se.c < prev    next >
C/C++ Source or Header  |  1998-09-29  |  17KB  |  735 lines

  1. #include "global.h"
  2. #include "edit.h"
  3. #include "comm.h"
  4. #include "file.h"
  5. #include "icon.h"
  6. #include "menu.h"
  7. #include "rsc.h"
  8. #include "text.h"
  9. #include "window.h"
  10. #include "se.h"
  11.  
  12. /* exprortierte Variablem *****************************************************/
  13. SHELLENTRY se_shells[SHELLANZ];    /* 0 - 4 : qed sucht Shell */
  14.                                             /* 5        : Shell sucht qed */
  15.  
  16. bool     se_activ;                /* haben wir Kontakt zur Shell? */
  17. bool    se_autosave,
  18.         se_autosearch;
  19.  
  20.  
  21. /* lokale Variablem **********************************************************/
  22. typedef struct _separm
  23. {
  24.     int    id;
  25.     int    shellCmd;
  26.     int    editCmd;
  27.     int    se_version;
  28.     char    prog_name[25];
  29. } SEPARMS;
  30.  
  31. static SEPARMS    shell_parm,
  32.                     edit_parm;
  33. static int        aktiv;                /* Nummer der aktiven Shell (0..SHELLANZ - 1) */
  34. static int        menu_len;
  35. static long        timer;                /* wird hochgezählt */
  36. static bool        wait_for_answer;    /* TRUE, wenn auf SE_OK/_ACK gewartet wird */
  37. static char        org_menu[8][25];
  38.  
  39. /*****************************************************************************/
  40. #define WAITTIME    2000                /* Zeit in ms, die qed auf ein SE_ACK wartet */
  41.  
  42. /* lokale Prototypen */
  43. static void    send_ok(void);
  44. static void    send_ack(bool ok);
  45. static void    send_cmd(int cmd, int bit);
  46. static void    send_esquit(void);
  47.  
  48.  
  49. static void    setup_makefile(void)
  50. {
  51.     FILENAME n = "";
  52.  
  53.     if (se_shells[aktiv].makefile[0] == EOS)
  54.         menu_text(menu, MSMAKEFILE, org_menu[0]);
  55.     else
  56.     {
  57.         file_name(se_shells[aktiv].makefile, n, FALSE);
  58.         fillup_menu(MSMAKEFILE, n, 2);
  59.     }
  60. }
  61.  
  62.  
  63. static void set_titel(char *titel)
  64. {
  65.     char str[25] = " ";
  66.  
  67.     strcat(str, titel);
  68.     strcat(str, " ");
  69.     menu_bar(menu, 0);
  70.     menu[2].ob_width = menu_len + (int)strlen(str) * sys_wbox;
  71.     menu[TSHELL].ob_width = (int)strlen(str) * sys_wbox;
  72.     strcpy(menu[TSHELL].ob_spec.free_string, str);
  73.     menu_bar(menu, 1);
  74.     update_menu();
  75. }
  76.  
  77. void setup_semenu(void)
  78. {
  79.     int    i;
  80.  
  81.     if (se_activ)
  82.     {
  83.         setup_makefile();
  84.         set_menu(MSQUIT, TRUE);
  85.         set_menu(MSMAKEFILE, (shell_parm.editCmd & _ESMAKE));
  86.         set_menu(MSCOMP, (shell_parm.editCmd & _ESCOMPILE));
  87.         set_menu(MSMAKE, (shell_parm.editCmd & _ESMAKE));
  88.         set_menu(MSMAKEALL, (shell_parm.editCmd & _ESMAKEALL));
  89.         set_menu(MSLINK, (shell_parm.editCmd & _ESLINK));
  90.         set_menu(MSEXEC, (shell_parm.editCmd & _ESEXEC));
  91.         set_menu(MSMAKEEXEC, (shell_parm.editCmd & _ESMAKEEXEC));
  92.         set_menu(MSSHELL, (shell_parm.editCmd & _ESSHLCTRL));
  93.     }
  94.     else
  95.     {
  96.         for (i = MSQUIT; i <= MSSHELL; i++)
  97.             set_menu(i, FALSE);
  98.     }
  99. }
  100.  
  101.  
  102. static void reset_shell_menu(void)
  103. {
  104.     int    i;
  105.  
  106.     set_titel("Shell");
  107.     menu_text(menu, MSMAKEFILE, org_menu[0]);
  108.     for (i = MSCOMP; i <= MSSHELL; i++)
  109.         menu_text(menu, i, org_menu[i - MSCOMP + 1]);
  110. }
  111.  
  112.  
  113. void    timer_se(void)
  114. {
  115.     if (wait_for_answer)
  116.     {
  117.         timer += TIMER_INTERVALL;
  118.         if (timer > WAITTIME)
  119.         {
  120.             timer = 0;
  121.             wait_for_answer = FALSE;
  122.             if (note(2, 0, SENOANS) == 1)
  123.             {
  124.                 se_activ = FALSE;
  125.                 set_titel("Shell");
  126.             }
  127.         }
  128.     }
  129. }
  130.  
  131.  
  132. static void set_timer(void)
  133. {
  134.     timer = 0;
  135.     wait_for_answer = TRUE;
  136. }
  137.  
  138.  
  139. static void reset_timer(void)
  140. {
  141.     timer = 0;
  142.     wait_for_answer = FALSE;
  143. }
  144.  
  145. /* Shell -> Editor ************************************************************/
  146.  
  147.  
  148. /* Antwort auf SE_INIT */
  149. static void    send_ok(void)
  150. {
  151.     if (shell_parm.editCmd & _ESOK)
  152.     {
  153.         if (debug_level & DBG_SE)
  154.             debug("sendOK -> %d\n", shell_parm.id);
  155.         memset(msgbuff, 0, (int)sizeof(msgbuff));
  156.         msgbuff[0] = ES_OK;
  157.         msgbuff[1] = edit_parm.id;
  158.         msgbuff[3] = edit_parm.shellCmd;
  159.         msgbuff[5] = edit_parm.editCmd;
  160.         msgbuff[6] = SEPROTOVERSION;
  161.         msgbuff[7] = shell_parm.id;
  162.         send_msg(shell_parm.id);
  163.     }
  164. }
  165.  
  166.  
  167. static void    send_ack(bool ok)
  168. {
  169.     if (shell_parm.editCmd & _ESACK)
  170.     {
  171.         if (debug_level & DBG_SE)
  172.             debug("sendAck -> %d\n", shell_parm.id);
  173.         memset(msgbuff, 0, (int)sizeof(msgbuff));
  174.         msgbuff[0] = ES_ACK;
  175.         msgbuff[1] = edit_parm.id;
  176.         msgbuff[3] = ok;
  177.         send_msg(shell_parm.id);
  178.     }
  179. }
  180.  
  181.  
  182. void handle_se(int *msg)
  183. {
  184.     PATH             datei, fehler;
  185.     char            str[9], *p, *p2;
  186.     int            icon, i, d, x;
  187.     long            y;
  188.     ERRINFO        *error;
  189.     SEMENUINFO    *pmenu;
  190.  
  191.     switch (msg[0])
  192.     {
  193.         case SE_INIT :
  194.             if (debug_level & DBG_SE)
  195.             {
  196.                 debug("SE_INIT von %d\n", msg[1]);
  197.                 debug("      shellCmd = %d\n", msg[3]);
  198.                 debug("      editCmd  = %d\n", msg[5]);
  199.                 debug("      version  = 0x%X\n", msg[6]);
  200.             }
  201.             if (se_activ)
  202.                 send_esquit();
  203.             shell_parm.id = msg[1];
  204.             shell_parm.shellCmd = msg[3];
  205.             shell_parm.editCmd  = msg[5];
  206.             shell_parm.se_version = msg[6];
  207.             send_ok();
  208.             se_activ = TRUE;
  209.  
  210.             /* Wir versuchen den GEM-Namen des Senders zu ermitteln */
  211.             if (gl_magx)
  212.             {
  213.                 /* MagiC-Special, funkt auch, wenn es kein appl_search gibt */
  214.                 sprintf(str, "? %cXXXXX", (char) shell_parm.id);
  215.                 str[1] = '\0';
  216.                 appl_find(str);
  217.             }
  218.             else
  219.             if ((appl_xgetinfo(4, &d, &d, &i, &d)) && (i == 1))    /* gibts appl_search? */
  220.             {
  221.                 int    type, id;
  222.  
  223.                 i = appl_search( 0, str, &type, &id);
  224.                 while (i != 0)
  225.                 {
  226.                     if (type == 2 && id == shell_parm.id)
  227.                         break;
  228.                     i = appl_search( 1, str, &type, &id);
  229.                 }
  230.             }
  231.             else
  232.                 strcpy(str, "Shell");
  233.  
  234.             aktiv = SHELLANZ - 1;
  235.             if ((p = strchr(str, ' ')) != NULL)        /* Blanks am Ende abschneiden */
  236.                 *p = EOS;
  237.             for (i = 0; i < SHELLANZ - 1; i++)        /* Shell eine der angemeldeten? -> Makefile */
  238.             {
  239.                 if (strcmp(str, se_shells[i].name) == 0)
  240.                     aktiv = i;
  241.             }
  242.             if (aktiv == SHELLANZ - 1)                    /* Shell nicht angemeldet */
  243.             {
  244.                 strcpy(se_shells[aktiv].name, str);
  245.                 strcpy(se_shells[aktiv].makefile, "");
  246.             }
  247.             set_titel(se_shells[aktiv].name);
  248.             break;
  249.         case SE_OK        :
  250.             reset_timer();
  251.             if (debug_level & DBG_SE)
  252.             {
  253.                 debug("SE_OK von %d\n", msg[1]);
  254.                 debug("      shellCmd = %d\n", msg[3]);
  255.                 debug("      editCmd  = %d\n", msg[5]);
  256.                 debug("      version  = 0x%X\n", msg[6]);
  257.             }
  258.             shell_parm.id         = msg[1];
  259.             shell_parm.shellCmd = msg[3];
  260.             shell_parm.editCmd  = msg[5];
  261.             shell_parm.se_version = msg[6];
  262.             se_activ = TRUE;
  263.             set_titel(se_shells[aktiv].name);
  264.             break;
  265.         case SE_ACK     :
  266.             reset_timer();
  267.             if (debug_level & DBG_SE)
  268.                 debug("SE_ACK von %d\n", msg[1]);
  269.             break;
  270.         case SE_OPEN    :
  271.             p = *(char **)(msg + 3);
  272.             if (p != NULL)
  273.                 strcpy(datei, p);
  274.             if (debug_level & DBG_SE)
  275.             {
  276.                 debug("SE_OPEN von %d\n", msg[1]);
  277.                 debug("      name = %s\n", datei);
  278.             }
  279.             if (shell_parm.se_version >= 0x102)
  280.             {
  281.                 x = msg[7];
  282.                 y = (*(long *)(msg + 5));
  283.                 if (debug_level & DBG_SE)
  284.                 {
  285.                     debug("      zeile = %ld\n", y);
  286.                     debug("      spalte = %d\n", x);
  287.                 }
  288.             }
  289.             send_ack(TRUE);
  290.             if ((strlen(datei) > 0) && file_exists(datei))
  291.             {
  292.                 icon = load_edit(datei, FALSE);
  293.                 if ((shell_parm.se_version >= 0x102) && (icon > 0) &&
  294.                     (x >= 1) && (y >= 1))
  295.                 {
  296.                     desire_x = x - 1;
  297.                     desire_y = y - 1;
  298.                     icon_edit(icon, DO_GOTO);
  299.                 }
  300.             }
  301.             break;
  302.         case SE_ERROR :
  303.             error = *(ERRINFO **)(msg + 3);
  304.             if (error != NULL)
  305.             {
  306.                 if (debug_level & DBG_SE)
  307.                     debug("SE_ERROR von %d\n", msg[1]);
  308.                 strcpy(datei, error->errFile);
  309.                 strcpy(fehler, error->errMess);
  310.                 x = error->errRow;
  311.                 y = error->errLine;
  312.             }
  313.             send_ack(TRUE);
  314.             if ((strlen(datei) > 0) && file_exists(datei))
  315.             {
  316.                 icon = load_edit(datei, FALSE);
  317.                 if (icon > 0)
  318.                 {
  319.                     char    str[256];
  320.  
  321.                     strcpy(str, rsc_string(ERRORSTR));
  322.                     strcat(str, fehler);
  323.                     set_info(get_text(icon), str);
  324.                     if ((x >= 1) && (y >= 1))
  325.                     {
  326.                         desire_x = x - 1;
  327.                         desire_y = y - 1;
  328.                         icon_edit(icon, DO_GOTO);
  329.                     }
  330.                 }
  331.             }
  332.             break;
  333.         case SE_ERRFILE :
  334.             p = *(char **)(msg + 5);
  335.             p2 = *(char **)(msg + 3);
  336.             if ((p != NULL) && (p2 != NULL))
  337.             {
  338.                 strcpy(datei, p);
  339.                 strcpy(fehler, p2);
  340.                 if (debug_level & DBG_SE)
  341.                 {
  342.                     debug("SE_ERRFILE von %d\n", msg[1]);
  343.                     debug("      name   = %s\n", datei);
  344.                     debug("      fehler = %s\n", fehler);
  345.                 }
  346.             }
  347.             send_ack(TRUE);
  348.             if ((strlen(datei) > 0) && file_exists(datei))
  349.                 icon = load_edit(datei, FALSE);
  350.             if ((strlen(fehler) > 0) && file_exists(fehler))
  351.             {
  352.                 icon = load_edit(fehler, FALSE);
  353.                 if (icon > 0)
  354.                 {
  355.                     do_icon(icon, DO_ABAND);
  356.                     desire_x = 0;
  357.                     desire_y = 0;
  358.                     icon_edit(icon, DO_GOTO);
  359.                 }
  360.             }
  361.             break;
  362.         case SE_PROJECT :
  363.             p = *(char **)(msg + 3);
  364.             if (p != NULL)
  365.                 strcpy(datei, p);
  366.             else
  367.                 strcpy(datei, "");
  368.             if (debug_level & DBG_SE)
  369.             {
  370.                 debug("SE_PROJECT von %d\n", msg[1]);
  371.                 debug("      name = %s\n", datei);
  372.             }
  373.              send_ack(TRUE);
  374.             if (file_exists(datei))
  375.             {
  376.                 strcpy(se_shells[aktiv].makefile, datei);
  377.                 setup_makefile();
  378.             }
  379.              break;
  380.         case SE_QUIT :
  381.             if (debug_level & DBG_SE)
  382.                 debug("SE_QUIT von %d\n", msg[1]);
  383.             se_activ = FALSE;
  384.             reset_shell_menu();
  385.             break;
  386.         case SE_CLOSE :
  387.             if (shell_parm.se_version >= 0x101)
  388.             {
  389.                 p = *(char **)(msg + 3);
  390.                 if ((p != NULL) && (strlen(p) > 0))
  391.                 {
  392.                     strcpy(datei, p);
  393.                      send_ack(TRUE);
  394. /*
  395.                     if (debug_level & DBG_SE)
  396. */
  397.                         debug("SE_CLOSE von %d, Datei: %s, Flag: %d\n", msg[1], datei, msg[5]);
  398.                     close_edit(datei, msg[5]);
  399.                 }
  400.             }
  401.             else
  402.             {
  403.                  send_ack(TRUE);
  404.                 close_edit("*.*", 1);
  405.             }
  406.              break;
  407.         case SE_MENU :
  408.             pmenu = *(SEMENUINFO **)(msg + 3);
  409.             if (pmenu != NULL)
  410.             {
  411.                 if (debug_level & DBG_SE)
  412.                     debug("SE_MENU von %d\n", msg[1]);
  413.  
  414.                 if ((pmenu->compStr != NULL) && (strlen(pmenu->compStr) > 0))
  415.                     fillup_menu(MSCOMP, pmenu->compStr, 2);
  416.                 if ((pmenu->makeStr != NULL) && (strlen(pmenu->makeStr) > 0))
  417.                     fillup_menu(MSMAKE, pmenu->makeStr, 2);
  418.                 if ((pmenu->makeAllStr != NULL) && (strlen(pmenu->makeAllStr) > 0))
  419.                     fillup_menu(MSMAKEALL, pmenu->makeAllStr, 2);
  420.                 if ((pmenu->linkStr != NULL) && (strlen(pmenu->linkStr) > 0))
  421.                     fillup_menu(MSLINK, pmenu->linkStr, 2);
  422.                 if ((pmenu->execStr != NULL) && (strlen(pmenu->execStr) > 0))
  423.                     fillup_menu(MSEXEC, pmenu->execStr, 2);
  424.                 if ((pmenu->makeExecStr != NULL) && (strlen(pmenu->makeExecStr) > 0))
  425.                     fillup_menu(MSMAKEEXEC, pmenu->makeExecStr, 2);
  426.                 
  427.                 if (shell_parm.se_version >= 0x104)
  428.                     if ((pmenu->progName != NULL) && (strlen(pmenu->progName) > 0))
  429.                         set_titel(pmenu->progName);
  430.  
  431.                 if (shell_parm.se_version >= 0x105)
  432.                     if ((pmenu->shellCtrlStr != NULL) && (strlen(pmenu->shellCtrlStr) > 0))
  433.                         fillup_menu(MSSHELL, pmenu->shellCtrlStr, 2);
  434.  
  435.                  send_ack(TRUE);
  436.             }
  437.             break;
  438.         default:
  439.             break;
  440.     } /* switch */
  441. }
  442.  
  443.  
  444. /* Editor -> Shell ************************************************************/
  445.  
  446.  
  447. static void    send_esquit(void)
  448. {
  449.     if (debug_level & DBG_SE)
  450.         debug("sendESQUIT -> %d\n", shell_parm.id);
  451.     memset(msgbuff, 0, (int)sizeof(msgbuff));
  452.     msgbuff[0] = ES_QUIT;
  453.     msgbuff[1] = edit_parm.id;
  454.     (void) send_msg(shell_parm.id);
  455.     se_activ = FALSE;
  456. }
  457.  
  458.  
  459. static void    send_esinit(int app)
  460. {
  461.     if (debug_level & DBG_SE)
  462.         debug("sendESINIT -> %d\n", app);
  463.     memset(msgbuff, 0, (int)sizeof(msgbuff));
  464.     msgbuff[0] = ES_INIT;
  465.     msgbuff[1] = edit_parm.id;
  466.     msgbuff[3] = edit_parm.shellCmd;
  467.     msgbuff[5] = edit_parm.editCmd;
  468.     msgbuff[6] = SEPROTOVERSION;
  469.     send_msg(app);
  470. }
  471.  
  472.  
  473. static void    send_esshlctrl(int flag)
  474. {
  475.     memset(msgbuff, 0, (int)sizeof(msgbuff));
  476.     msgbuff[0] = ES_SHLCTRL;
  477.     msgbuff[1] = edit_parm.id;
  478.     if (global_str1[0] != EOS)
  479.         *(char **) &msgbuff[3] = global_str1;
  480.     else
  481.         *(char **) &msgbuff[3] = NULL;
  482.     msgbuff[5] = flag;
  483.     send_msg(shell_parm.id);
  484. }
  485.  
  486.  
  487. static void    send_cmd(int cmd, int bit)
  488. {
  489.     if (shell_parm.editCmd & bit)
  490.     {
  491.         memset(msgbuff, 0, (int)sizeof(msgbuff));
  492.         msgbuff[0] = cmd;
  493.         msgbuff[1] = edit_parm.id;
  494.         if (global_str1[0] != EOS)
  495.             *(char **) &msgbuff[3] = global_str1;
  496.         else
  497.             *(char **) &msgbuff[3] = NULL;
  498.         if (!send_msg(shell_parm.id))
  499.         {
  500.             se_activ = FALSE;
  501.             set_titel("Shell");
  502.             note(1, 2, SENOANS);
  503.             return;
  504.         }
  505.         set_timer();
  506.     }
  507. }
  508.  
  509. static void get_filename(int icon)
  510. {
  511.     TEXTP     t_ptr;
  512.  
  513.     if (icon != -1)
  514.     {
  515.         t_ptr = get_text(icon);
  516.         strcpy(global_str1, t_ptr->filename);
  517.     }
  518.     else
  519.         strcpy(global_str1, "");
  520. }
  521.  
  522. static bool such_shell(void)
  523. {
  524.     int    i, j;
  525.     char    name[9];
  526.  
  527.     for (i = 0; i < SHELLANZ - 1; i++)
  528.     {
  529.         strcpy(name, se_shells[i].name);
  530.         if (name[0])
  531.         {
  532.             for (j = (int) strlen(name); j < 8; j++)
  533.                 strcat(name, " ");
  534.             j = appl_find(name);
  535.             if (j > 0)
  536.             {
  537.                 aktiv = i;
  538.                 send_esinit(j);
  539.                 set_timer();
  540.                 return TRUE;
  541.             }
  542.         }
  543.     }
  544.     return FALSE;
  545. }
  546.  
  547. static void se_options(void)
  548. {
  549.     int    i, antw;
  550.     char    tmp[30];
  551.  
  552.     if (se_activ)
  553.     {
  554.         sprintf(tmp, "%s, SE-Version %x", se_shells[aktiv].name, shell_parm.se_version);
  555.         set_string(seoptions, SESTATUS, tmp);
  556.     }
  557.     else
  558.         set_string(seoptions, SESTATUS, "--");
  559.     
  560.     for (i = 0; i < SHELLANZ - 1; i++)
  561.         set_string(seoptions, SENAME1 + i, se_shells[i].name);
  562.  
  563.     set_state(seoptions, SESAVE, SELECTED, se_autosave);
  564.     set_state(seoptions, SESEARCH, SELECTED, se_autosearch);
  565.  
  566.     set_flag(seoptions, SEOK, DEFAULT, se_activ);
  567.     set_flag(seoptions, SESUCH, DEFAULT, !se_activ);
  568.     
  569.     antw = simple_mdial(seoptions, SENAME1) & 0x7fff;
  570.     if ((antw == SEOK) || (antw == SESUCH))
  571.     {
  572.         for (i = 0; i < SHELLANZ - 1; i++)
  573.         {
  574.             get_string(seoptions, SENAME1 + i, se_shells[i].name);
  575.             str_toupper(se_shells[i].name);
  576.         }
  577.  
  578.         se_autosave = get_state(seoptions, SESAVE, SELECTED);
  579.         se_autosearch = get_state(seoptions, SESEARCH, SELECTED);
  580.  
  581.         if (antw == SESUCH)
  582.         {
  583.             if (se_activ)
  584.             {
  585.                 antw = note(2, 0, SEONLINE);
  586.                 if (antw == 2)
  587.                     return;
  588.                 else
  589.                 {
  590.                     send_esquit();
  591.                     set_titel("Shell");
  592.                 }
  593.             }
  594.             if (!such_shell())
  595.                 note(1, 0, SENOTFOUND);
  596.         }
  597.     }
  598. }
  599.  
  600. static void do_sesave(WINDOWP window)
  601. {
  602.     if (window != NULL)
  603.     {
  604.         TEXTP    t_ptr;
  605.         
  606.         t_ptr = get_text(window->handle);
  607.         if ((t_ptr!= NULL) && (t_ptr->moved != 0))
  608.             do_icon(window->handle, DO_SAVE);
  609.     }
  610. }
  611.  
  612. void handle_es(int item)
  613. {
  614.     WINDOWP    window;
  615.     int        top_icon = -1;
  616.     
  617.     if (item == MSOPT)
  618.         se_options();
  619.  
  620.     if (!se_activ)
  621.         return ;
  622.  
  623.     window = winlist_top();
  624.     if (window != NULL && window->class == CLASS_EDIT)
  625.         top_icon = window->handle;
  626.  
  627.     switch (item)
  628.     {
  629.         case MSQUIT :
  630.             send_esquit();
  631.             reset_shell_menu();
  632.             break;
  633.  
  634.         case MSMAKEFILE:
  635.             if (shift_pressed() && se_shells[aktiv].makefile[0] != EOS)    /* Makefile löschen */
  636.             {
  637.                 se_shells[aktiv].makefile[0] = EOS;
  638.                 update_menu();
  639.                 if (shell_parm.se_version >= 0x101)
  640.                 {
  641.                     strcpy(global_str1, "");
  642.                     send_cmd(ES_PROJECT, _ESPROJECT);
  643.                 }
  644.                 break;
  645.             }
  646.             if (select_single(se_shells[aktiv].makefile, "", rsc_string(FINDMKSTR)))
  647.             {
  648.                 setup_makefile();
  649.                 strcpy(global_str1, se_shells[aktiv].makefile);
  650.                 send_cmd(ES_PROJECT, _ESPROJECT);
  651.             }
  652.             break;
  653.  
  654.         case MSCOMP :
  655.             if (se_autosave)
  656.                 do_sesave(window);
  657.             get_filename(top_icon);
  658.             if ((global_str1[0] != EOS) || (shell_parm.se_version >= 0x103))
  659.                 send_cmd(ES_COMPILE, _ESCOMPILE);
  660.             break;
  661.  
  662.         case MSMAKE :
  663.             if (se_autosave)
  664.                 do_all_window(CLASS_EDIT, do_sesave);
  665.             strcpy(global_str1, se_shells[aktiv].makefile);
  666.             send_cmd(ES_MAKE, _ESMAKE);
  667.             break;
  668.  
  669.         case MSMAKEALL :
  670.             if (se_autosave)
  671.                 do_all_window(CLASS_EDIT, do_sesave);
  672.             strcpy(global_str1, se_shells[aktiv].makefile);
  673.             send_cmd(ES_MAKEALL, _ESMAKEALL);
  674.             break;
  675.  
  676.         case MSLINK :
  677.             get_filename(top_icon);
  678.             send_cmd(ES_LINK, _ESLINK);
  679.             break;
  680.  
  681.         case MSEXEC :
  682.             get_filename(top_icon);
  683.             send_cmd(ES_EXEC, _ESEXEC);
  684.             break;
  685.  
  686.         case MSMAKEEXEC :
  687.             if (se_autosave)
  688.                 do_all_window(CLASS_EDIT, do_sesave);
  689.             strcpy(global_str1, se_shells[aktiv].makefile);
  690.             send_cmd(ES_MAKEEXEC, _ESMAKEEXEC);
  691.             break;
  692.  
  693.         case MSSHELL :
  694.             if (se_autosave)
  695.                 do_sesave(window);
  696.             get_filename(top_icon);
  697.             send_esshlctrl(0);            /* Shell toppen */
  698.             break;
  699.  
  700.     } /* switch */
  701. }
  702.  
  703. void    init_se(void)
  704. {
  705.     int    i;
  706.  
  707.     se_activ = FALSE;
  708.     menu_len = menu[2].ob_width - menu[TSHELL].ob_width;
  709.     set_titel("Shell");
  710.  
  711.     /* Menüeinträge sichern */
  712.     strcpy(org_menu[0], (char *)get_obspec(menu, MSMAKEFILE));
  713.     for (i = MSCOMP; i <= MSSHELL; i++)
  714.         get_string(menu, i, org_menu[i - MSCOMP + 1]);
  715.  
  716.     shell_parm.id         = -1;
  717.     shell_parm.shellCmd = 0;
  718.     shell_parm.editCmd  = 0;
  719.  
  720.     edit_parm.id          = gl_apid;
  721.     edit_parm.shellCmd  = (_SEINIT|_SEOK|_SEACK|_SEQUIT|_SEOPEN|_SEERROR|_SEERRFILE|_SEPROJECT|_SECLOSE|_SEMENU);
  722.     edit_parm.editCmd     = (_ESINIT|_ESOK|_ESACK|_ESQUIT|_ESCOMPILE|_ESMAKE|_ESMAKEALL|_ESLINK|_ESEXEC|_ESMAKEEXEC|_ESPROJECT|_ESSHLCTRL);
  723.  
  724.     setup_makefile();
  725.  
  726.     if (se_autosearch)
  727.         such_shell();
  728. }
  729.  
  730. void term_se(void)
  731. {
  732.     if (se_activ && (shell_parm.editCmd & _ESQUIT))
  733.         send_esquit();
  734. }
  735.